package jdk8.function.interfaceX;

/**
 * 日志案例
 * 以下代码存在浪费问题:
 * 当日志级别不为1时日志不会打印, 但是会拼接String
 **/
public class Demo02Logger {
    public static void showLog(int level, String msg) {
        if ( level == 1) {
            System.out.println(msg);
        }
    }

    public static void main(String[] args) {
        String msg1 = " Hello ";
        String msg2 = " World ";
        String msg3 = " Java ";
        // 显示日志

        showLog(1, msg1 + msg2 + msg3);

    }
}
